//==============================================================================
#include "CMusic.h"

//==============================================================================
CMusic CMusic::MusicControl;

//==============================================================================
CMusic::CMusic() {
    Music = NULL;
}

//------------------------------------------------------------------------------
bool CMusic::OnLoad(char* File) {
    if(Music != NULL) {
        OnCleanup();
    }

    if((Music = Mix_LoadMUS(File)) == NULL) {
        return false;
    }

    return true;
}

//------------------------------------------------------------------------------
void CMusic::OnCleanup() {
    Mix_FreeMusic(Music);

    Music = NULL;
}

//==============================================================================
void CMusic::Play() {
    if(Music == NULL) return;

    Mix_PlayMusic(Music, -1);
}

//==============================================================================